package hivemq.controller;

import hivemq.service.ProducerService;
import com.atguigu.springcloud.config.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * MQTT生产者 前端控制器
 *
 * @author zhenyu
 * @since 2022-07-25
 */
@Api(value = "发布主题", tags = "发布主题")
@RestController
@RequestMapping("/producer")
@Slf4j
public class Controller {

  @Autowired
  private ProducerService producerService;

  @PostMapping("/send")
  @ApiOperation("MQTT发布消息")
  public Result<Object> send(@RequestParam("topic") String topic,@RequestParam("message") String message){
    return producerService.send(topic,message);
  }

}
